import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
const store = new Vuex.Store({
	state:{
		userinfo:uni.getStorageSync("user-info") || {avatar:'../../static/Rectangle 109.png',nickname:'Gthjd_521'},
		TotalPrice:0,
		token: uni.getStorageSync("token") ||'',
		addressList:[],
		openid:uni.getStorageSync("openid")||'',
		odas:null
	},
	mutations:{
		setToken(state,payload){
			uni.setStorageSync('token',payload)
			state.token = payload
		},
		deletetoken(state,payload){
			uni.removeStorageSync('token');
		},
		setuser(state,info){
			state.userinfo = info
			uni.setStorageSync('user-info',state.userinfo)
		},
		delusinfo(state,info){
			uni.removeStorageSync('user-info');
		},
		setopenid(state,open){
			state.openid = open
			uni.setStorageSync('openid',open)
		},
		delopenid(state,open){
			uni.removeStorageSync('openid');
		},
		pricemd(state,num){
			state.TotalPrice += num 
		},
		subtraction(state,num){
			state.TotalPrice -= num 
		},
		emptymoney(state,num){
			state.TotalPrice = 0
		},
		setodres(state,el){
			state.odas = el
		}
	},
	actions:{
		
	},
	getters:{
		
	},
	modules:{
		
	}
})
export default store